package com.ruoyi.business.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.business.vo.TUserOptLogVo;
import com.ruoyi.business.service.ITUserOptLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

/**
 * 【用户操作日志查询】Controller
 *
 * @author Tellsea
 * @date 2024-12-24
 */
@Api(tags = "【用户操作日志查询】Controller")
@RestController
@RequestMapping("/business/userOptLog")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TUserOptLogController extends BaseController {

    private final ITUserOptLogService tUserOptLogService;

    @ApiOperation("获取【根据id获取操作记录】详细信息")
    @PreAuthorize("@ss.hasPermi('business:userOptLog:query')")
    @GetMapping(value = "/getInfo/{toUserid}")
    public AjaxResult getInfo(@PathVariable("toUserid") String toUserid) {
        return AjaxResult.success("查询成功", tUserOptLogService.queryById(toUserid));
    }

    @ApiOperation("新增【添加操作记录】")
    @PreAuthorize("@ss.hasPermi('business:userOptLog:add')")
    @Log(title = "【添加操作记录】", businessType = BusinessType.INSERT)
    @PostMapping("add")
    public AjaxResult add(@RequestBody TUserOptLogVo entity) {
        return toAjax(tUserOptLogService.save(entity));
    }


}
